﻿using OnlineMealOrdering.Models;
using OnlineMealOrdering.Persistence;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;

namespace OnlineMealOrdering.Areas.WebSiteManage.Controllers
{
    public class StoreOnlineController : Controller
    {

        public ActionResult StoreOnlineList(int id = 1)
        {
            using (var ctx = new OnlineStoreDomainContext())
            {
                var list = OnlineMealOrdering.Areas.WebSiteManage.Models.StoreOnlineModel.GetAllStoreOnline(id, 15);
                return View(list);
            }
        }

        [ValidateInput(false)]
        public ActionResult StoreOnlineEdit(int? id)
        {
            using (var ctx = new OnlineStoreDomainContext())
            {
                var model = OnlineMealOrdering.Areas.WebSiteManage.Models.StoreOnlineModel.GetStoreOnline(id.Value);
                return View(model);
            }
        }

        [ValidateInput(false)]
        public ActionResult AddStoreOnline(int id)
        {
            using (var ctx = new OnlineStoreDomainContext())
            {
                //var model = OnlineMealOrdering.Areas.WebSiteManage.Models.StoreOnlineModel.GetStoreOnline(id.Value);
                //return View(model);
                return View();
            }
        }

    }
}
